package com.ruoyi.common.baidu;

import com.alibaba.fastjson2.JSONObject;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Request;
import com.dtflys.forest.annotation.Retry;
import com.dtflys.forest.annotation.Var;
import com.ruoyi.common.baidu.retry.BaiduCommonRetryWhen;

/**
 * 调用百度api
 *
 * @author liaowen
 * @date 2024/11/8 14:18
 */
@BaseRequest(baseURL = "https://aip.baidubce.com")
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = BaiduCommonRetryWhen.class)
public interface BaiduRequestClient {


    @Request(url = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=${apiKey}&client_secret=${secretKey}", type = "GET")
    JSONObject getAccessToken(@Var("apiKey") String apiKey, @Var("secretKey") String secretKey);


}
